package com.kzd.gtboon.callback

import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

abstract class AppPagerAdapter(fm: FragmentManager, val tabs: Array<String>) :
    FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {

    abstract fun fragment(position: Int): Fragment

    override fun getItem(position: Int): Fragment {
        return fragment(position)
    }

    override fun getCount(): Int = tabs.size

    override fun getPageTitle(position: Int): CharSequence =
        tabs[position]

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {}
}